package top.kaoshanji.p1ch04a;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.text.ChoiceFormat;

/**
 * 代码清单 p1ch04a-14：ChoiceFormat类的使用示例
 * author kaoshanji
 * ^_^
 * create time 2025/1/15 19:55
 */
public class NumberFormatExample03 {

    private static final Logger logger = LogManager.getLogger(NumberFormatExample03.class);

    public static void main(String[] args) {
        logger.info("...代码清单 p1ch04a-14：ChoiceFormat类的使用示例...");

        ChoiceFormat format = new ChoiceFormat(new double[] {0, 1, ChoiceFormat.nextDouble(1)},
                new String[] {"no people", "person", "people"});
        int count = 2;
        String msg = count + " " + format.format(count);
        logger.info("...msg:{}...", msg);

    }

}
